import { _decorator, Component, Label, Node, Sprite, SpriteFrame } from 'cc';
import { UIBase } from '../../FrameWork3.8.6/FrameWork/UIFramework/UIBase';
import { PropertyDt } from '../../FrameWork3.8.6/FrameWork/Common/CommonInterface';
import { ResMgr } from '../../FrameWork3.8.6/FrameWork/Res/ResMgr';
import { BundleConfig } from '../../FrameWork3.8.6/FrameWork/NeedToChange/BundleConfig';
const { ccclass, property } = _decorator;

@ccclass('EquipDetailsPanel')
export class EquipDetailsPanel extends UIBase {
    onInit(...rest: any[]): void {
        this.addClickEventListener("_CloseBtn",()=>{
            this.closeSelf();
        })
    }
    onEnter(...rest: any[]): void {
         this.node.setSiblingIndex(1000);
        let propertyDt=rest[0] as PropertyDt;
        this.refreshEquipDetails(propertyDt);
    }

    //更新数据的方法
    refreshEquipDetails(propertyDt:PropertyDt){
        this.getComp<Sprite>("_Img","Sprite").spriteFrame=ResMgr.instance.getRes<SpriteFrame>(BundleConfig.Img.name,propertyDt.iconName);
        this.getComp<Label>("_NameLabel","Label").string=propertyDt.name;
    }
}


